package com.xiaocikuai.smallchunks.controller.JTEController;

import com.alibaba.fastjson.JSONObject;
import com.yl.jms.sdk.JtExpressApi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

/**
 * 云路供应链科技有限公司 版权所有 © Copyright 2021
 *
 * @Description: 物流轨迹订阅
 * @Author: xuyangyang
 * @Date: 2020/12/29 15:54
 */
@RestController
public class LogisticsSubscriptionController {
    /**
     * 物流轨迹订阅接口地址
     */
    public static final String url = "http://test-openapi.jtexpress.com.cn/webopenplatformapi/api/trace/subscribe";

    @Autowired
    private JtExpressApi jtExpressApi;

    @Value("178337126125932605")
    public String apiAccount;

    @GetMapping("/subscribe")
    public JSONObject subscribe() throws IOException {
        Map<String, Object> map = new HashMap<>();
        HashMap<String, Object> listMap = new HashMap<>();
        listMap.put("traceNode","1&2&3&4&5&6&7&8&9&10&11");
        listMap.put("waybillCode","UT0000344603151");
        map.put("Id",apiAccount);
        map.put("list",listMap);
        JSONObject location = jtExpressApi.post(map,url);
        return location;
    }
}
